package com.example.administrator.wallet.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.wallet.R;
import com.example.administrator.wallet.view.activity.RecoveryActivity;

/**
 * Effect:
 * <p>
 * Author:  CaiYapeng
 * <p>
 * Time  :  2018/7/30.
 */
public class RecoveryAdapter extends BaseAdapter {

    private Context context;
    private String[] size;

    public RecoveryAdapter(RecoveryActivity recoveryActivity, String[] size) {
        this.context = recoveryActivity;
        this.size = size;
    }

    @Override
    public int getCount() {
        return size==null?0:size.length;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if (view == null) {
            view = View.inflate(context, R.layout.item_recovery_grid, null);
            holder = new ViewHolder();
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }

        holder.mEdit = (TextView) view.findViewById(R.id.mEdit);
        holder.mEdit.setText(size[i]);
        return view;
    }

    private class ViewHolder {
        private TextView mEdit;
    }
}
